package xiaojian.toolkit.netty.transport.endpoint;

import io.netty.channel.Channel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;

public abstract class DefaultEndpointFactory implements EndpointFactory {

	public ServerEndpoint createEndpoint(Channel channel) {
		ServerEndpoint endpoint = createEndpoint();
		endpoint.setChannel(channel);
		endpoint.start();
		return endpoint;
	}
	
	public void endpointReleased(Endpoint endPoint){
		//Nothing todo.
	}

	public void stop() {
	}

	public void send(Object bean) {
		throw new RuntimeException("Unsupport Operation for send.");
	}

	public int getPendingCount() {
		throw new RuntimeException("Unsupport Operation for send.");
	}

	protected abstract ServerEndpoint createEndpoint();
}
